# input()接收鍵盤的输入(字符串)，参数是提示文字，python中字符可以用单引号或双引号
# int()把字符串转换为整数

#
year = int(input('年份为：'))
month = int(input('月份为：'))
day = int(input('日期为：'))
# #年份每月的天数
# ruen = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, ]
# ruen1 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, ]
# days = 0
# #判断是否为闰年
# if year % 400 == 0 or (year % 4==0 and year % 100 != 0):
#     print('这年是闰年')
#     #进入循环遍历月份
#     for i in range(len(ruen)):
#         if i < month - 1:
#             #满足月份之和
#             days = days + ruen[i]
#         else:
#             #与当月天数相加
#             days = days + day
#             break
#
# else:
#     print('这年不是闰年')
#     for i in range(len(ruen1)):
#         if i < month - 1:
#             days = days + ruen1[i]
#         else:
#             days = days + day
#             break
#
# print(f'这天是{year}年的第{days}天')
#


# 优化代码
# 创建一年每月天数的数组
totel = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, ]
days = 0
# 判断是否为闰年
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
    # 改数组中的二月为29天
    totel[2] = 29
# 遍历这12个月
for i in range(len(totel)):
    # 求出月份前的所有天数
    if i < month - 1:
        days += totel[i]
    else:
        days += day
        break

print(f'这天是{year}年的第{days}天')
